#!/bin/bash

# Array of module names to be unloaded
MODULES=("0234l" "0234r" "newRGB_l" "newRGB_r")

# Loop through each module name in the array
for MODULE in "${MODULES[@]}"; do
    # Check if the module is loaded
    if lsmod | grep -q "$MODULE"; then
        # If the module is loaded, attempt to remove it
        rmmod "$MODULE" 
        echo "Unloading module $MODULE"
    else
        # If the module is not loaded, print a message
        echo "Module $MODULE is not loaded, no need to unload."
    fi
done

echo "Module unloading process is complete."